import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class TextAndStyle extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("文本及样式"),
      ),
      body: Column(
        children: [
          Text(
            "Hello world Left",
            textAlign: TextAlign.right,
          ),
          Text("Hello world! I'm Jack. " * 4,
              maxLines: 1, overflow: TextOverflow.ellipsis),
          Text("Hello world", textScaleFactor: 1.5),
          Text("Hello world",
              style: TextStyle(
                  color: Colors.blue,
                  fontSize: 18.0,
                  height: 1.2,
                  fontFamily: "Courier",
                  background: Paint()..color = Colors.yellow,
                  decoration: TextDecoration.underline,
                  decorationStyle: TextDecorationStyle.dashed)),
          Text.rich(
              TextSpan(style: TextStyle(height: 2, fontSize: 18.0), children: [
            TextSpan(text: "Home:"),
            TextSpan(
              text: "https://flutterchina.club",
              style: TextStyle(color: Colors.blue),
            )
          ])),
          DefaultTextStyle(
              style: TextStyle(color: Colors.red, fontSize: 20.0),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  Text("hello world"),
                  Text("I am Jack"),
                  Text("I am Jack",
                    style: TextStyle(
                      inherit: false,
                      color: Colors.grey
                    ),
                  )
                ],
              ))
        ],
      ),
    );
  }
}
